﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class JoystickInput : IUserInput
{
    public string keyJup;
    public string keyJright;
    public string keyJdown;
    public string keyJleft;
    public string keyUp;
    public string keyRight;
    public string keyDown;
    public string keyLeft;

    // Update is called once per frame
    void Update()
    {
        Dright = Input.GetAxis("Horizontal");
        Dup = Input.GetAxis("Vertical");
        if (enabledInput == false)
        {
            Dright = 0;
            Dup = 0;
        }
        Vector2 output = SquareToCircle(Dright, Dup);        
        vec = transform.forward * output.y + transform.right * output.x;
        mag = Mathf.Sqrt(output.x * output.x + output.y * output.y);

        Jup = Input.GetAxis("Axis5");
        Jright = Input.GetAxis("Axis4");

        isRun = Input.GetButton("btn0");
        isDefend = Input.GetButton("btn4");

        isJump = Input.GetButtonDown("btn1");
        lb = Input.GetButtonDown("btn4");
        rb = Input.GetButtonDown("btn5");
        isLockOn = Input.GetButtonDown("btn3");
    }    
}
